import { ApiProperty } from '@nestjs/swagger';
import { PartialType } from '@nestjs/swagger';
import { Decorator_DtoIsNumber_Base } from '@/common/decorators/dtoIsNumber';
import {
  Constant_Enum_Enum_UserAdmin_Status,
  IConstant_Enum_Type_UserAdmin_Status,
} from '@/common/constants/enum';
import { IsNotEmpty, IsOptional, IsString } from 'class-validator';
import { Others_PageClass_Base } from '@/common/others/pageClass';

export class UserAdmin_Create_Dto {
  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '用户名称' })
  userName: string;

  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '用户密码' })
  password: string;

  @Decorator_DtoIsNumber_Base()
  @IsNotEmpty()
  @ApiProperty({ description: '用户角色' })
  roleId: number;

  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '用户头像' })
  avatar: string;

  @IsString()
  @IsOptional()
  @ApiProperty({
    description: '用户状态',
    enum: Constant_Enum_Enum_UserAdmin_Status,
  })
  statusUser?: IConstant_Enum_Type_UserAdmin_Status;
}
export class UserAdmin_Update_Dto extends PartialType(UserAdmin_Create_Dto) {
  @Decorator_DtoIsNumber_Base()
  @IsNotEmpty()
  id: number;
}

export class UserAdmin_Find_Dto extends Others_PageClass_Base {
  @IsString()
  @IsOptional()
  @ApiProperty({ description: '用户名称' })
  userName?: string;

  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  id?: number;

  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  @ApiProperty({ description: '用户角色Id' })
  roleId?: number;
}
